package com.wondersgroup.fjzlpt.org.controller.view.fwb;

import javax.servlet.http.HttpServletRequest;

import com.quick.framework.util.QuickPrincipalUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.web.wapper.QuickPrincipal;
import com.wondersgroup.fjzlpt.org.dao.inter.fwbFwxx.FwbFwxxDAO;

@Controller
@RequestMapping("fwb")
public class FwbController {
	@Autowired
	private FwbFwxxDAO fwbFwxxDAO;
	
	@RequestMapping("/index.html")
	public String index(HttpServletRequest request)
	{
        JSONObject json = new JSONObject();
        json.put("JGXZQHDM", QuickPrincipalUtils.getXzqhdm(request));
        json.put("PTJGID", QuickPrincipalUtils.getPtjgID(request));
        request.setAttribute("userInfo", json);
		return "fwb/index";
	}

	@RequestMapping("/manager.html")
	public String manager(HttpServletRequest request)
	{
        JSONObject json = new JSONObject();
		json.put("JGXZQHDM", QuickPrincipalUtils.getXzqhdm(request));
        json.put("WSJGLBDM", QuickPrincipalUtils.getJglbdm(request));
        json.put("PTJGID", QuickPrincipalUtils.getPtjgID(request));
        json.put("YLJGMC", QuickPrincipalUtils.getUserinfoByKey(request,"YLJGMC"));
        request.setAttribute("userInfo", json);
		String FWBID = request.getParameter("FWBID");
		if(!StringUtils.isEmpty(FWBID)){
			JSONArray ary = fwbFwxxDAO.queryFwxxsByFwbId(FWBID);
			request.setAttribute("fwxAry", ary);
		}
		return "fwb/manager";
	}
	
	@RequestMapping("/detail.html")
	public String detail(HttpServletRequest request)
	{
		String FWBID = request.getParameter("FWBID");
		if(!StringUtils.isEmpty(FWBID)){
			JSONArray ary = fwbFwxxDAO.queryFwxxsByFwbId(FWBID);
			request.setAttribute("fwxAry", ary);
		}
		return "fwb/detail";
	}
	
}
